package cn.ht.jywrwater.module.ht.dal.mysql.waterpipenetmaintain;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.waterpipenetmaintain.WaterPipenetMaintainDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.waterpipenetmaintain.vo.*;

/**
 * 管网养护 Mapper
 *
 * @author hzx
 */
@Mapper
public interface WaterPipenetMaintainMapper extends BaseMapperX<WaterPipenetMaintainDO> {

    default PageResult<WaterPipenetMaintainDO> selectPage(WaterPipenetMaintainPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WaterPipenetMaintainDO>()
                .eqIfPresent(WaterPipenetMaintainDO::getType, reqVO.getType())
                .eqIfPresent(WaterPipenetMaintainDO::getCaliber, reqVO.getCaliber())
                .eqIfPresent(WaterPipenetMaintainDO::getMaterial, reqVO.getMaterial())
                .eqIfPresent(WaterPipenetMaintainDO::getReason, reqVO.getReason())
                .eqIfPresent(WaterPipenetMaintainDO::getSource, reqVO.getSource())
                .betweenIfPresent(WaterPipenetMaintainDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterPipenetMaintainDO::getId));
    }

    default List<WaterPipenetMaintainDO> selectList(WaterPipenetMaintainExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WaterPipenetMaintainDO>()
                .eqIfPresent(WaterPipenetMaintainDO::getType, reqVO.getType())
                .eqIfPresent(WaterPipenetMaintainDO::getCaliber, reqVO.getCaliber())
                .eqIfPresent(WaterPipenetMaintainDO::getMaterial, reqVO.getMaterial())
                .eqIfPresent(WaterPipenetMaintainDO::getReason, reqVO.getReason())
                .eqIfPresent(WaterPipenetMaintainDO::getSource, reqVO.getSource())
                .betweenIfPresent(WaterPipenetMaintainDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WaterPipenetMaintainDO::getId));
    }

}
